package com.ethink.order.converter;

import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Component;
import com.ethink.framework.common.converter.Converter;
import com.ethink.order.api.info.SaleDemandOrderInfo;
import com.ethink.order.common.entity.SaleDemandOrder;

/**
 * 销售需求单 Converter转换器
 *
 * @author default
 * @date 2022-10-31
 */
@Component
public class SaleDemandOrderConverter implements Converter<SaleDemandOrderInfo, SaleDemandOrder> {

    @Override
    public SaleDemandOrder convertTo(SaleDemandOrderInfo info) {
        if(info == null) {
            return null;
        }
        SaleDemandOrder entity = new SaleDemandOrder ();
        BeanUtils.copyProperties(info, entity);
        return entity;
    }

    @Override
    public SaleDemandOrderInfo convertFrom(SaleDemandOrder entity) {
        if(entity == null) {
            return null;
        }
        SaleDemandOrderInfo info = new SaleDemandOrderInfo();
        BeanUtils.copyProperties(entity, info);
        return info;
    }
}
